<?php

class Service_RestController extends Service_Library_Controller_Action
{
	protected $_restClient = null;
	protected $_fiboClientNo = null;
	protected $_fiboClientPass = null;
	
	public function init() {
		parent::init();
		$this->_fiboClientNo = $this->_config->fibo_client_no;
		$this->_fiboClientPass = $this->_config->fibo_client_pass;
		$this->_restClient = new Zend_Rest_Client($this->_config->fibo_uri);
		
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
	}
	
	public function aboutAction() {
		$response = $this->_restClient->restGet('/Service.asmx/About');
		$body = $response->getBody();
		$body = html_entity_decode($body);
		echo $body;
	}
	
	public function checkClientAction() {
		$response = $this->_restClient->restGet('/Service.asmx/CheckClient', array('clientNo' => $this->_fiboClientNo, 'clientPass' => $this->_fiboClientPass));
		$body = $response->getBody();
		$body = html_entity_decode($body);
		$xml = new Zend_Config_Xml($body);
		$arr = $xml->toArray();
		Zend_Debug::dump($arr);
	}
}